// 初始化axios实例
import axios from 'axios';


const server = {
  // url: 'http://10.10.10.155:8191/jiahua-version',
  url: 'https://c-c.jiahuagame.com/jiahua-version',
}

if (window.location.href.match('jiahua')) {
  server.url = 'https://c-c.jiahuagame.com/jiahua-version'
}


const instance = axios.create({
  baseURL: server.url,
  timeout: 12000,
});

instance.defaults.headers.post['Content-Type'] = 'application/json';
// 错误处理
instance.interceptors.response.use(function(response) {
  return response;
}, (err) => {
  console.dir(err)
  return Promise.reject(err)
});

export default instance;